package ru.ifmo.croak.impl.stress.post.team3;

import ru.ifmo.croak.api.PostService;
import ru.ifmo.croak.util.CroakFactory;

public class PostStressMain implements Runnable {
	private PostService postService;
	private static int numberSenders = 100;
	private static int delay = 10;

	public PostStressMain(String name) {
		String postProviderName = CroakFactory.getInstance().getProperty(
				name + ".provider");
		postService = CroakFactory.getInstance().getImplementation(
				PostService.class, postProviderName);
	}

	public static void main(String[] args) {
		new Thread(new PostStressMain("stress.post")).start();
	}

	@Override
	public void run() {
		Tester tester = new Tester(numberSenders, delay, postService);
		Thread t = new Thread(tester);
		t.start();
		try {
			while (true) {
				Thread.sleep(100);
			}
		} catch (InterruptedException e) {
		}
		tester.stop();
		t.interrupt();
	}
}
